//
//  ViewController.swift
//  myGeekTime
//
//  Created by moon on 2021/6/12.
//

import UIKit
import SnapKit


class ViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        
        
        
        let homeVC = HomeViewController()
        homeVC.tabBarItem.image = R.image.home()
        homeVC.tabBarItem.selectedImage = R.image.home_selected()?.withRenderingMode(.alwaysOriginal)
        homeVC.tabBarItem.setTitleTextAttributes([.foregroundColor:UIColor.hexColor(0x333333)], for: .selected)
        homeVC.tabBarItem.title = "首页"
//        homeVC.hidesBottomBarWhenPushed = true
        
        let navgationHomeVC = UINavigationController(rootViewController: homeVC)
        
        addChild(navgationHomeVC)
        
        
        
        
        let mineVC = MineViewController()
        mineVC.tabBarItem.image = R.image.mine()
        mineVC.tabBarItem.selectedImage = R.image.mine_selected()?.withRenderingMode(.alwaysOriginal)
        mineVC.tabBarItem.setTitleTextAttributes([.foregroundColor:UIColor.hexColor(0x333333)], for: .selected)
        mineVC.tabBarItem.title = "我的"
//        mineVC.hidesBottomBarWhenPushed = true

        
        
        let navgationMineVC = UINavigationController(rootViewController: mineVC)
        
        addChild(navgationMineVC)
        
        
        
        /*
        
        let testButton = UIButton(type: .custom)
        
        testButton.setTitle("跳转", for: .normal)
        
        testButton.setTitleColor(.blue, for: .normal)
        
        testButton.addTarget(self, action: #selector(testButtonClick), for: .touchUpInside)
        view .addSubview(testButton)
        
        testButton.snp.makeConstraints { (make) in
            make.width.equalTo(100)
            make.height.equalTo(50)
            make.center.equalToSuperview()
        }
        */
        
    }
    
    
    @objc func testButtonClick() -> Void {
        
        let loginVC = LoginViewController()
        
        navigationController?.pushViewController(loginVC, animated: true)
        
    }


}

